package demo03_AbstractFactory;

import demo03_AbstractFactory.factory.SystemFactory;

public class AbstractMethodUtil {
    private static final String path = SystemFactory.class.getPackage().getName()+".%s";
    private static final String factoryext = "Factory";
    static public SystemFactory getBean(String systemName) throws Exception {
        String className = String.format(path, systemName + factoryext);
        Class clazz = Class.forName(className);
        Object o = clazz.newInstance();
        return (SystemFactory) o;
    }
}
